import React, { Component } from 'react'
import { Link } from 'react-router-dom'

export default class List extends Component {
  constructor() {
    super()
    this.state = {
      list: [
        {name: 'apple', id: 1},
        {name: 'banana', id: 2},
        {name: 'peach', id: 3},
      ]
    }
  }
  render() {
    return (
      <div>
        {
          this.state.list.map(item => {
            return (
              <Link key={item.id} to={'/detail/'+item.name}>
                <button>{item.name}</button>
              </Link>
            )
          })
        }
      </div>
    )
  }
}
